export default function() {
  const url = window.location.href;
  const params = url.split('?')[1]
  let res = {}
  if(params) {
    try {
      res =
        params.split('&')
          .reduce((res, item) => {
            const kv = item.split('=')
            return {
              ...res,
              [kv[0]]: kv[1],
            }
          }, {})
    } catch (error) {
      console.log('参数格式错误')
    }
  }
  return res
}